package com.windoent.yugioh.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.windoent.yugioh.R;

/**
 * author : robert
 * date   : 2021/4/28 11:23
 * desc   :
 */
public class GameTypeMeInfoNumer extends RelativeLayout {
    private Context mConText;
    private TextView mTvNumber;
    private TextView mTvName;
    private String name;
    private int color;


    public GameTypeMeInfoNumer(Context context) {
        this(context, null, 0);
    }

    public GameTypeMeInfoNumer(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public GameTypeMeInfoNumer(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        this.mConText = context;
        LayoutInflater.from(mConText).inflate(R.layout.custom_view_game_type_meinfo_number, this);
        TypedArray attributes = mConText.obtainStyledAttributes(attrs, R.styleable.GameTypeMeInfoNumer, 0, 0);
        try {
            name = attributes.getString(R.styleable.GameTypeMeInfoNumer_name);
            color = attributes.getColor(R.styleable.GameTypeMeInfoNumer_color, Color.parseColor("#FF1BD458"));
        } finally {
            attributes.recycle();
        }
        setUpView();
    }

    private void setUpView() {
        mTvNumber = (TextView) findViewById(R.id.tv_number);
        mTvName = (TextView) findViewById(R.id.tv_name);
        mTvNumber.setTextColor(color);
        mTvName.setText(name);
    }

    public void setNumber(String s) {
        mTvNumber.setText(s);
    }

}
